﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.Linq;

namespace JetRetail
{
    public partial class GetCashierForm : Form
    {
        JetRetailDB DB;
        public int iCashierKey;
        public string sCashierName;

        public GetCashierForm(JetRetailDB DB)
        {
            InitializeComponent();

            this.DB=DB;

            iCashierKey = 0;
        }

        private void CashierCode_TextChanged(object sender, EventArgs e)
        {
            try
            {
                ISingleResult<ПолучитьПродавцаResult> Result = DB.ПолучитьПродавца(CashierCode.Text);
                foreach (ПолучитьПродавцаResult DataSet in Result)
                {
                    iCashierKey = Convert.ToInt32(DataSet.Key);
                    sCashierName = DataSet.Имя;
                }
                if (iCashierKey != 0) this.Close();
            }
            catch (Exception e2)
            {
                MessageBox.Show(e2.Message, "Jet-Розница", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
    }
}
